-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SONiC Yang model support for COPP #7199
Conversation
can you split the test cases? |
@dgsudharsan to review |
retest please |
} | ||
|
||
leaf trap_ids { | ||
type string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response here
|
||
leaf red_action { | ||
type string { | ||
pattern "(drop)|(forward)|(copy)|(copy_cancel)|(trap)|(log)|(deny)|(transit)" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
} | ||
description | ||
"CPU queue id"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> cpu rx queue id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
leaf trap_ids { | ||
type string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoPP HLD expects the trap_ids name to be specific string. Should we define a pattern here, something based on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trap_ids is a string with comma separated trap_ids.
"arp": {
"trap_ids": "arp_req,arp_resp,neigh_discovery",
"trap_group": "queue4_group3"
},
If we have to define a pattern based on copporch,
trap_ids can be defined as leaf-list in yang i.e array.
leaf-list trap_ids {
mandatory true;
type enumeration {
enum arp_req;
enum arp_resp;
enum arp_suppress;
...
...
enum vrrp;
enum vrrpv6;
}
description "list of trap_ids";
}
But, this would also mandate
- changes to copp_cfg.j2 trap_ids fields as below:
"arp": {
"trap_ids": [
"arp_req",
"arp_resp",
"neigh_discovery"
],
"trap_group": "queue4_group2"
},
- changes to coppmgr to handle array of trap_ids. Otherwise, it results into
ERR swss#coppmgrd: :- main: Runtime error: type must be string, but is array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. im not expecting a change to coppmgr or template.
leaf queue { | ||
type uint8 { | ||
range "0..47" { | ||
error-message "Invalid value passed for queue"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why the range is restricted to 48 queues? Is there any restriction imposed in SAI regarding the maximum number of queues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed range "0..47" {
|
||
leaf trap_priority { | ||
type uint16 { | ||
range "0..1023" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the SAI headers the range is dependent on platforms. I am not sure why the priority is restricted to 0-1023
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default attrvalue SAI_SWITCH_ATTR_ACL_ENTRY_MINIMUM_PRIORITY
* @validonly SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_TRAP or SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_COPY
*/
SAI_HOSTIF_TRAP_ATTR_TRAP_PRIORITY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed range "0..1023" {
"Red action"; | ||
} | ||
|
||
leaf genetlink_name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If genetlink name and mc_group name are exposed to north bound interfaces to be modified what is the purpose of restricting here to a single value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genetlink_name and genetlink_mcgrp_name are applicable to sFlow only. Current supported values are "psample" and "packets" respectively. Default copp_cfg.j2 does have these defined. However, user may chose to create a new copp_group COPP_GROUP|sflow-group and bind it to COPP_TRAP|sflow. Hence these fields are defined in yang and restricted to allowed patterns (psample, packets).
genetlink_name = genetlink_name ;[Optional] "psample" for sFlow
genetlink_mcgrp_name = multicast group name; ;[Optional] "packets" for sFlow
@dgsudharsan, Are you suggesting not to expose these fields through yang ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not expose these to user as these are internal implementations. I am not sure why an external user would be interested in specifying details about internal communication mechanisms. @prsunny Please let me your thoughts on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I think genetlink part can be removed from Yang and it is internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed leaf genetlink_name and leaf genetlink_mcgrp_name
"Control plane policing trap name"; | ||
} | ||
|
||
leaf trap_ids { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this mandatory field ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
"Red action"; | ||
} | ||
|
||
leaf genetlink_name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this leaf needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Response here
5c0980c
to
5e6fe39
Compare
42e1d0f
to
442027b
Compare
retest this please |
retest please |
@amaneti, can you resolve the conflicts |
@arlakshm - conflicts are resolved. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
af71268
@arlakshm, @anshuv-mfst - rebased, build passed. |
can you please resolve the conflict? |
**- What I did** Created SONiC Yang model for COPP. Tables: COPP_GROUP, COPP_TRAP. **- How I did it** Defined Yang models for COPP based on Guideline doc: https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md and https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md **- How to verify it** $ pytest tests/yang_model_tests/test_yang_model.py -v ============================================================================== test session starts =============================================================================== platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.32, pluggy-0.4.0 -- /usr/bin/python cachedir: .cache rootdir: /sonic/src/sonic-yang-models, inifile: plugins: cov-2.4.0 collected 1 items tests/yang_model_tests/test_yang_model.py::Test_yang_models::test_run_tests PASSED ============================================================================ 1 passed in 0.50 seconds ============================================================================
* defaults to fields: COPP_GROUP queue, trap_priority, color, cir, cbs, green_action, yellow_action, red_action * Mandatory fields: COPP_GROUP trap_action, meter_type, mode and COPP_TRAP|trap_ids * Add more tests
rebased, resolved conflicts. |
@arlakshm, @anshuv-mfst - rebased, build passed. |
@arlakshm - could you please help with merge, thanks. |
* SONiC Yang model support for COPP * Tables: COPP_GROUP, COPP_TRAP.
Why I did it
Created SONiC Yang model for COPP.
Tables: COPP_GROUP, COPP_TRAP.
How I did it
Defined Yang models for COPP based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md
How to verify it
Which release branch to backport (provide reason below if selected)
Description for the changelog
A picture of a cute animal (not mandatory but encouraged)